using Core;
using IglooCoder.Commons.WcfNhibernate;
using NHibernate;

namespace Infrastucture
{
    public class CashBankInRepository : BaseNHibernateRepository<CashBankIn>
    {
        public CashBankInRepository(ISessionStorage sessionStorage)
            : base(sessionStorage)
        {
        }


        public string GetMaxNumber(string code,string kodeAwal)
        {
            string res = string.Empty;
            var lenKode = kodeAwal.Length + 11 + code.Length;
            var query = Session.CreateSQLQuery("Select Max(NoVoucher) as Number from CashBankIN  where NoVoucher like'" + kodeAwal + "%' AND NoVoucher like'%" + code + "%'" );
            var objRes = query.List()[0];
            if (objRes != null) res = objRes.ToString();
            return res;
        }
    }
}